#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>

MODULE_LICENSE("GPL");
unsigned char *pagemem;
unsigned char *kmallocmem;
unsigned char *vmallocmem;
int __init mem_module_init(void)
{
	printk("insmod mem_module\r\n");
	pagemem = (unsigned char*)__get_free_page(0);
	printk("pagemem addr=%x\r\n", pagemem);
	kmallocmem = (unsigned char*)kmalloc(100, 0);
	printk("kmallocmem addr=%x\r\n", kmallocmem);
	vmallocmem = (unsigned char*)vmalloc(1000000);
	printk("vmallocmem addr=%x\r\n", vmallocmem);

	pagemem[0] = 1;
	pagemem[8192] = 1;
	kmallocmem[0] = 2;
	kmallocmem[100] = 2;
	vmallocmem[0] = 3;
	vmallocmem[1000000] = 3;
	return 0;
}

void __exit mem_module_exit(void)
{
	printk("rmmod mem_module\r\n");
	free_page(pagemem);
	kfree(kmallocmem);
	vfree(vmallocmem);
}
module_init(mem_module_init);
module_exit(mem_module_exit);
